import clc from 'cli-color';
export class Logger{
    private static lastLogTime = Date.now()
    static log(message:string,context:string=''){
        // 获取当前时间戳
        const timestamp = new Date().toLocaleDateString();
        // 获取当前进程的ID node变量
        const pid = process.pid;
        let currentTime = Date.now();
        const timeDiff = currentTime - this.lastLogTime;
        let logMsg = `[${clc.green('Nest')}] ${clc.green(pid.toString())} - ${clc.green(timestamp)} ${clc.green('LOG')}  [${clc.yellow(context)}]  ${clc.green(message)} +${clc.yellow(timeDiff)}ms`
        console.log(logMsg);
        this.lastLogTime = currentTime;
    }
}